package com.spring.cloud.consumer.project.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.spring.cloud.consumer.project.service.MService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class VController {

    @Autowired
    private MService mService;

    @GetMapping(value = "get")
    @SentinelResource(value = "hello")
    public String rest(){
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return mService.getValue();
    }

    @GetMapping(value = "getA")
    public String geta(){
        return "getA";
    }
}
